package com.smedi.ismedi.inmail.core.domain.aggregatemodel;

import lombok.*;

import java.util.List;

/**
 * 通知公告基础信息
 *
 * @author jiangqinxuan
 * &#064;date  2021/07/26
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class Node {
    /**
     * id
     */
    private Long id;
    /**
     * 唯一标识
     */
    private String key;
    /**
     * 类型
     */
    private String type;
    /**
     * 名称
     */
    private String name;
    /**
     * 父节点
     */
    private Node parent;
    /**
     * 子节点
     */
    private List<Node> children;
    /**
     * 前缀路径
     */
    private String prefixPath;
    /**
     * 路径
     */
    private String path;

    public String getKey() {
        return this.type + "-" + this.id;
    }

    public String getPath() {
        if (null == this.prefixPath) {
            return this.getKey();
        }
        return this.prefixPath + "/" + this.getKey();
    }
}